	def ConsolidateThisMarket2(self,country,market): 
	# deprecated:add collection which are based on symbol, instead of symbol+date, to consolidate database.
		updatecount=0
		upcontents=[]
		provider_dic=dict()	
		alldic=dict() # dict to store all data
		
		colname=KDBUtility.GetCollectionName(country,market,True)
		self.db.drop_collection(colname)
		cldailystocks=self.db[KDBUtility.GetCollectionName("us",market,False)]
		newdailystocks=self.db[colname]
		
		self.UpdateProgress("searching all symbols for market: %s" %market)
		alldata=cldailystocks.find({})
		totalnum=alldata.count()
		# store into dict
		for each_rec in alldata:
			symbol=each_rec['symbol']
			date=each_rec['date']
			# initialize this symbol dict
			if not alldic.has_key(symbol):
				alldic[symbol]={}
				symbolitemdic=alldic[symbol]
				symbolitemdic['dateset']=set() # to exlucde duplicate
				symbolitemdic['dates']=[]
				symbolitemdic['priceblocks']=[]
			symbolitemdic=alldic[symbol]
			# initialize date of this symbol
			if date not in symbolitemdic['dateset']:
				symbolitemdic['dateset'].add(date)
				symbolitemdic['dates'].append(date)
				symbolitemdic['priceblocks'].append(each_rec['price'])			
			updatecount+=1
			if updatecount%10000==0:
				curatio=float(updatecount)/totalnum
				elapsed=(time.clock()-self.start)  
				message="Dict # %.2f Memory # %d K Time %.2f" %(curatio,sys.getsizeof(alldic)/1024,elapsed)
				self.UpdateProgress(message)
				print (message)
		# bulk update into database	
		for each_symbol in alldic:
			priceblock=alldic[each_symbol]['priceblocks']
			symbolcontent=[{"symbol":each_symbol.upper(),"date":dates,"price":priceblock}]
			upcontents+=symbolcontent
			if self.Stop:
				return False
			updatecount=updatecount+1
			if updatecount%200==0:
				#newdailystocks.insert(upcontents) # bulk insert
				upcontents=[]
				elapsed=(time.clock()-self.start)          
				self.UpdateProgress('Consolidating - M: %s S#: %d T:%.2f' %(market,updatecount,elapsed))

		self.UpdateProgress("Ensure Index for M:%s" %(market))      
		newdailystocks.ensure_index([("symbol",1)]) ## build index      
		return True